/**
 * 根组件
 * */
import React, { useReducer } from "react";
import { HashRouter as Router, Switch, Route } from "react-router-dom";
import { initState, initReducer, GlobalContext} from './store/reducer'
import Login from "./pages/login";
import Admin from "./pages/admin"
const App = () => {
	const [state, dispatch] = useReducer(initReducer, initState);
	return (
		<GlobalContext.Provider value={{state, dispatch}}>
			<Router>
				<Switch> {/*  只匹配其中一个  */}
					<Route path='/login' component={Login}></Route>
					<Route path='/' component={Admin}></Route>
				</Switch>
			</Router>
		</GlobalContext.Provider>
	)
}

export default App;


